home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1994-09-19 | 6.9 KB | [TEXT/MMCC] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Mon Sep 19 16:13:19 1994, modified Mon Sep 19 16:13:19 1994, creator 'MMCC', type ASCII, 6306 bytes "PsychometricFit.c" , at 0x1922 438 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MMCC] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 11 50 73 79 63 68 6f | 6d 65 74 72 69 63 46 69 |..Psycho|metricFi|
|00000010| 74 2e 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |t.c.....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 00 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 18 a2 00 | 00 01 b6 aa a3 a1 5f aa |........|......_.|
|00000060| a3 a1 5f 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.._.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 35 af 00 00 |........|....5...|
|00000080| 2f 2a 20 0d 50 73 79 63 | 68 6f 6d 65 74 72 69 63 |/* .Psyc|hometric|
|00000090| 46 69 74 2e 63 0d 43 6f | 70 79 72 69 67 68 74 20 |Fit.c.Co|pyright |
|000000a0| 31 39 39 30 20 28 63 29 | 20 44 65 6e 69 73 20 47 |1990 (c)| Denis G|
|000000b0| 2e 20 50 65 6c 6c 69 0d | 41 20 67 65 6e 65 72 61 |. Pelli.|A genera|
|000000c0| 6c 2d 70 75 72 70 6f 73 | 65 20 66 75 6e 63 74 69 |l-purpos|e functi|
|000000d0| 6f 6e 20 74 68 61 74 20 | 64 6f 65 73 20 61 20 6d |on that |does a m|
|000000e0| 61 78 69 6d 75 6d 20 6c | 69 6b 65 6c 69 68 6f 6f |aximum l|ikelihoo|
|000000f0| 64 20 66 69 74 20 6f 66 | 20 61 6e 79 0d 70 73 79 |d fit of| any.psy|
|00000100| 63 68 6f 6d 65 74 72 69 | 63 20 66 75 6e 63 74 69 |chometri|c functi|
|00000110| 6f 6e 20 74 6f 20 70 73 | 79 63 68 6f 6d 65 74 72 |on to ps|ychometr|
|00000120| 69 63 20 64 61 74 61 2e | 20 54 68 65 20 72 65 74 |ic data.| The ret|
|00000130| 75 72 6e 65 64 20 76 61 | 6c 75 65 20 69 73 20 74 |urned va|lue is t|
|00000140| 68 65 20 6c 65 76 65 6c | 20 6f 66 0d 73 69 67 6e |he level| of.sign|
|00000150| 69 66 69 63 61 6e 63 65 | 20 61 74 20 77 68 69 63 |ificance| at whic|
|00000160| 68 20 74 68 65 20 66 69 | 74 20 63 61 6e 20 62 65 |h the fi|t can be|
|00000170| 20 72 65 6a 65 63 74 65 | 64 2e 20 54 68 65 20 64 | rejecte|d. The d|
|00000180| 65 67 72 65 65 73 4f 66 | 46 72 65 65 64 6f 6d 20 |egreesOf|Freedom |
|00000190| 6d 61 79 20 62 65 20 7a | 65 72 6f 2c 0d 69 6e 20 |may be z|ero,.in |
|000001a0| 77 68 69 63 68 20 63 61 | 73 65 20 6e 6f 20 70 61 |which ca|se no pa|
|000001b0| 72 61 6d 65 74 65 72 73 | 20 77 69 6c 6c 20 62 65 |rameters| will be|
|000001c0| 20 61 64 6a 75 73 74 65 | 64 2c 20 62 75 74 20 79 | adjuste|d, but y|
|000001d0| 6f 75 27 6c 6c 20 67 65 | 74 20 74 68 65 20 6c 6f |ou'll ge|t the lo|
|000001e0| 67 20 6c 69 6b 65 6c 69 | 68 6f 6f 64 0d 61 6e 64 |g likeli|hood.and|
|000001f0| 20 73 69 67 6e 69 66 69 | 63 61 6e 63 65 20 6f 66 | signifi|cance of|
|00000200| 20 74 68 65 20 73 75 70 | 70 6c 69 65 64 20 70 61 | the sup|plied pa|
|00000210| 72 61 6d 65 74 65 72 20 | 76 61 6c 75 65 73 2e 0d |rameter |values..|
|00000220| 0d 54 68 65 20 70 73 79 | 63 68 6f 6d 65 74 72 69 |.The psy|chometri|
|00000230| 63 20 66 75 6e 63 74 69 | 6f 6e 20 28 77 68 69 63 |c functi|on (whic|
|00000240| 68 20 79 6f 75 20 73 75 | 70 70 6c 79 20 61 73 20 |h you su|pply as |
|00000250| 61 6e 20 61 72 67 75 6d | 65 6e 74 29 20 74 61 6b |an argum|ent) tak|
|00000260| 65 73 20 74 77 6f 20 61 | 72 67 75 6d 65 6e 74 73 |es two a|rguments|
|00000270| 3a 0d 61 20 63 6f 6e 74 | 72 61 73 74 20 61 6e 64 |:.a cont|rast and|
|00000280| 20 61 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 61 20 | a point|er to a |
|00000290| 70 61 72 61 6d 52 65 63 | 6f 72 64 2e 20 54 68 65 |paramRec|ord. The|
|000002a0| 20 66 75 6e 63 74 69 6f | 6e 20 57 65 69 62 75 6c | functio|n Weibul|
|000002b0| 6c 28 29 20 69 73 20 70 | 72 6f 76 69 64 65 64 20 |l() is p|rovided |
|000002c0| 69 6e 0d 57 65 69 62 75 | 6c 6c 2e 63 2e 20 4f 74 |in.Weibu|ll.c. Ot|
|000002d0| 68 65 72 73 20 6d 61 79 | 20 62 65 20 61 64 64 65 |hers may| be adde|
|000002e0| 64 20 61 73 20 64 65 73 | 69 72 65 64 2e 20 49 74 |d as des|ired. It|
|000002f0| 20 69 73 20 61 73 73 75 | 6d 65 64 20 74 68 61 74 | is assu|med that|
|00000300| 20 74 68 65 20 66 69 72 | 73 74 0d 70 61 72 61 6d | the fir|st.param|
|00000310| 65 74 65 72 20 69 73 20 | 74 68 65 20 6c 6f 67 20 |eter is |the log |
|00000320| 6f 66 20 74 68 72 65 73 | 68 6f 6c 64 2e 20 4e 6f |of thres|hold. No|
|00000330| 20 61 73 73 75 6d 70 74 | 69 6f 6e 73 20 61 72 65 | assumpt|ions are|
|00000340| 20 6d 61 64 65 20 61 62 | 6f 75 74 20 74 68 65 20 | made ab|out the |
|00000350| 6f 74 68 65 72 0d 70 61 | 72 61 6d 65 74 65 72 73 |other.pa|rameters|
|00000360| 2c 20 65 78 63 65 70 74 | 20 74 68 61 74 20 61 6e |, except| that an|
|00000370| 79 20 74 68 61 74 20 61 | 72 65 20 74 6f 20 62 65 |y that a|re to be|
|00000380| 20 69 74 65 72 61 74 69 | 76 65 6c 79 20 66 69 74 | iterati|vely fit|
|00000390| 20 61 72 65 20 61 73 73 | 75 6d 65 64 20 74 6f 20 | are ass|umed to |
|000003a0| 62 65 20 6f 66 0d 74 79 | 70 65 20 22 64 6f 75 62 |be of.ty|pe "doub|
|000003b0| 6c 65 22 2e 0d 0d 51 75 | 69 63 6b 33 2e 63 20 69 |le"...Qu|ick3.c i|
|000003c0| 73 20 61 20 73 74 61 6e | 64 2d 61 6c 6f 6e 65 20 |s a stan|d-alone |
|000003d0| 70 72 6f 67 72 61 6d 20 | 74 68 61 74 20 75 73 65 |program |that use|
|000003e0| 73 20 50 73 79 63 68 6f | 6d 65 74 72 69 63 46 69 |s Psycho|metricFi|
|000003f0| 74 28 29 20 74 6f 20 64 | 6f 20 74 68 65 20 72 65 |t() to d|o the re|
|00000400| 61 6c 20 77 6f 72 6b 2e | 0d 49 20 73 75 67 67 65 |al work.|.I sugge|
|00000410| 73 74 20 79 6f 75 20 72 | 65 61 64 20 74 68 65 20 |st you r|ead the |
|00000420| 69 6e 74 72 6f 64 75 63 | 74 6f 72 79 20 63 6f 6d |introduc|tory com|
|00000430| 6d 65 6e 74 73 20 61 74 | 20 74 68 65 20 62 65 67 |ments at| the beg|
|00000440| 69 6e 6e 69 6e 67 20 6f | 66 20 51 75 69 63 6b 33 |inning o|f Quick3|
|00000450| 2e 63 0d 0d 48 49 53 54 | 4f 52 59 3a 0d 34 2f 37 |.c..HIST|ORY:.4/7|
|00000460| 2f 39 30 09 09 64 67 70 | 20 77 72 6f 74 65 20 69 |/90..dgp| wrote i|
|00000470| 74 0d 31 30 2f 32 39 2f | 39 30 09 64 67 70 09 74 |t.10/29/|90.dgp.t|
|00000480| 69 64 69 65 64 20 75 70 | 20 74 68 65 20 63 6f 6d |idied up| the com|
|00000490| 6d 65 6e 74 73 0d 31 31 | 2f 31 37 2f 39 32 09 64 |ments.11|/17/92.d|
|000004a0| 67 70 20 22 0d 31 2f 32 | 35 2f 39 33 20 64 67 70 |gp ".1/2|5/93 dgp|
|000004b0| 20 72 65 6d 6f 76 65 64 | 20 6f 62 73 6f 6c 65 74 | removed| obsolet|
|000004c0| 65 20 73 75 70 70 6f 72 | 74 20 66 6f 72 20 54 48 |e suppor|t for TH|
|000004d0| 49 4e 4b 20 43 20 34 2e | 0d 39 2f 35 2f 39 34 20 |INK C 4.|.9/5/94 |
|000004e0| 64 67 70 20 72 65 6d 6f | 76 65 64 20 61 73 73 75 |dgp remo|ved assu|
|000004f0| 6d 70 74 69 6f 6e 20 69 | 6e 20 70 72 69 6e 74 66 |mption i|n printf|
|00000500| 27 73 20 74 68 61 74 20 | 69 6e 74 3d 3d 73 68 6f |'s that |int==sho|
|00000510| 72 74 2e 0d 0d 53 4f 55 | 52 43 45 53 3a 0d 51 75 |rt...SOU|RCES:.Qu|
|00000520| 69 63 6b 33 2e 68 0d 4c | 6f 67 4c 69 6b 65 6c 69 |ick3.h.L|ogLikeli|
|00000530| 68 6f 6f 64 2e 63 0d 4d | 6f 6e 6f 74 6f 6e 69 63 |hood.c.M|onotonic|
|00000540| 46 69 74 2e 63 0d 50 73 | 79 63 68 6f 6d 65 74 72 |Fit.c.Ps|ychometr|
|00000550| 69 63 46 69 74 2e 63 0d | 53 6f 72 74 41 6e 64 4d |icFit.c.|SortAndM|
|00000560| 65 72 67 65 43 6f 6e 74 | 72 61 73 74 73 2e 63 0d |ergeCont|rasts.c.|
|00000570| 57 65 69 62 75 6c 6c 2e | 63 0d 23 46 72 6f 6d 20 |Weibull.|c.#From |
|00000580| 44 65 6e 69 73 20 50 65 | 6c 6c 69 27 73 20 56 69 |Denis Pe|lli's Vi|
|00000590| 64 65 6f 54 6f 6f 6c 62 | 6f 78 3a 0d 56 69 64 65 |deoToolb|ox:.Vide|
|000005a0| 6f 54 6f 6f 6c 62 6f 78 | 2e 68 0d 42 69 6e 6f 6d |oToolbox|.h.Binom|
|000005b0| 69 61 6c 2e 63 0d 43 68 | 69 53 71 75 61 72 65 2e |ial.c.Ch|iSquare.|
|000005c0| 63 0d 4e 6f 72 6d 61 6c | 2e 63 0d 53 65 74 46 69 |c.Normal|.c.SetFi|
|000005d0| 6c 65 49 6e 66 6f 2e 63 | 09 09 23 20 55 73 65 64 |leInfo.c|..# Used|
|000005e0| 20 6f 6e 6c 79 20 6f 6e | 20 74 68 65 20 4d 61 63 | only on| the Mac|
|000005f0| 69 6e 74 6f 73 68 0d 23 | 46 72 6f 6d 20 4e 75 6d |intosh.#|From Num|
|00000600| 65 72 69 63 61 6c 20 52 | 65 63 69 70 65 73 20 69 |erical R|ecipes i|
|00000610| 6e 20 43 3a 0d 6e 72 2e | 68 0d 4e 52 55 54 49 4c |n C:.nr.|h.NRUTIL|
|00000620| 2e 68 0d 42 52 45 4e 54 | 2e 43 0d 46 31 44 49 4d |.h.BRENT|.C.F1DIM|
|00000630| 2e 43 0d 4c 49 4e 4d 49 | 4e 2e 43 0d 4d 4e 42 52 |.C.LINMI|N.C.MNBR|
|00000640| 41 4b 2e 43 0d 4e 52 55 | 54 49 4c 2e 43 0d 50 4f |AK.C.NRU|TIL.C.PO|
|00000650| 57 45 4c 4c 2e 43 0d 0d | 4c 49 4d 49 54 41 54 49 |WELL.C..|LIMITATI|
|00000660| 4f 4e 53 0d 0d 54 68 69 | 73 20 70 72 6f 67 72 61 |ONS..Thi|s progra|
|00000670| 6d 20 75 73 65 73 20 72 | 6f 75 74 69 6e 65 73 20 |m uses r|outines |
|00000680| 66 72 6f 6d 20 4e 75 6d | 65 72 69 63 61 6c 20 52 |from Num|erical R|
|00000690| 65 63 69 70 65 73 20 69 | 6e 20 43 2e 20 54 68 65 |ecipes i|n C. The|
|000006a0| 79 27 72 65 20 63 6f 70 | 79 72 69 67 68 74 65 64 |y're cop|yrighted|
|000006b0| 2c 20 0d 73 6f 20 49 20 | 63 61 6e 27 74 20 64 69 |, .so I |can't di|
|000006c0| 73 74 72 69 62 75 74 65 | 20 74 68 65 6d 2e 20 59 |stribute| them. Y|
|000006d0| 6f 75 20 63 61 6e 20 6f | 72 64 65 72 20 74 68 65 |ou can o|rder the|
|000006e0| 20 73 6f 66 74 77 61 72 | 65 3a 0d 09 4e 75 6d 65 | softwar|e:..Nume|
|000006f0| 72 69 63 61 6c 20 52 65 | 63 69 70 65 73 20 43 20 |rical Re|cipes C |
|00000700| 44 69 73 6b 65 74 74 65 | 20 66 6f 72 20 4d 61 63 |Diskette| for Mac|
|00000710| 69 6e 74 6f 73 68 20 24 | 32 39 2e 39 35 0d 61 6e |intosh $|29.95.an|
|00000720| 64 20 62 6f 6f 6b 3a 0d | 09 4e 75 6d 65 72 69 63 |d book:.|.Numeric|
|00000730| 61 6c 20 52 65 63 69 70 | 65 73 20 69 6e 20 43 3a |al Recip|es in C:|
|00000740| 20 54 68 65 20 41 72 74 | 20 6f 66 20 53 63 69 65 | The Art| of Scie|
|00000750| 6e 74 69 66 69 63 20 43 | 6f 6d 70 75 74 69 6e 67 |ntific C|omputing|
|00000760| 20 24 34 34 2e 35 30 0d | 66 72 6f 6d 3a 0d 09 43 | $44.50.|from:..C|
|00000770| 61 6d 62 72 69 64 67 65 | 20 55 6e 69 76 65 72 73 |ambridge| Univers|
|00000780| 69 74 79 20 50 72 65 73 | 73 0d 09 4f 72 64 65 72 |ity Pres|s..Order|
|00000790| 20 44 65 70 61 72 74 6d | 65 6e 74 0d 09 35 31 30 | Departm|ent..510|
|000007a0| 20 4e 6f 72 74 68 20 41 | 76 65 6e 75 65 0d 09 4e | North A|venue..N|
|000007b0| 65 77 20 52 6f 63 68 65 | 6c 6c 65 2c 20 4e 59 20 |ew Roche|lle, NY |
|000007c0| 31 30 38 30 31 0d 0d 4e | 6f 74 65 20 74 68 61 74 |10801..N|ote that|
|000007d0| 20 49 20 68 61 76 65 20 | 6d 61 64 65 20 73 65 76 | I have |made sev|
|000007e0| 65 72 61 6c 20 63 68 61 | 6e 67 65 73 20 74 6f 20 |eral cha|nges to |
|000007f0| 74 68 65 20 4e 75 6d 65 | 72 69 63 61 6c 20 52 65 |the Nume|rical Re|
|00000800| 63 69 70 65 73 20 69 6e | 20 43 20 72 6f 75 74 69 |cipes in| C routi|
|00000810| 6e 65 73 3a 20 0d 31 2e | 49 6e 20 65 76 65 72 79 |nes: .1.|In every|
|00000820| 20 66 69 6c 65 20 49 20 | 63 68 61 6e 67 65 64 20 | file I |changed |
|00000830| 22 66 6c 6f 61 74 22 20 | 74 6f 20 22 46 4c 4f 41 |"float" |to "FLOA|
|00000840| 54 22 2c 20 61 6e 64 20 | 23 69 6e 63 6c 75 64 65 |T", and |#include|
|00000850| 64 20 6e 72 2e 68 2e 20 | 49 20 69 6e 73 65 72 74 |d nr.h. |I insert|
|00000860| 65 64 20 74 68 65 20 0d | 73 74 61 74 65 6d 65 6e |ed the .|statemen|
|00000870| 74 20 22 74 79 70 65 64 | 65 66 20 64 6f 75 62 6c |t "typed|ef doubl|
|00000880| 65 20 46 4c 4f 41 54 3b | 22 20 69 6e 20 74 68 65 |e FLOAT;|" in the|
|00000890| 20 66 69 6c 65 20 6e 72 | 2e 68 2e 20 54 68 69 73 | file nr|.h. This|
|000008a0| 20 69 73 20 62 65 63 61 | 75 73 65 20 74 68 65 20 | is beca|use the |
|000008b0| 0d 4d 61 63 69 6e 74 6f | 73 68 20 63 6f 6d 70 75 |.Macinto|sh compu|
|000008c0| 74 65 73 20 64 6f 75 62 | 6c 65 73 20 6d 75 63 68 |tes doub|les much|
|000008d0| 20 66 61 73 74 65 72 20 | 74 68 61 6e 20 66 6c 6f | faster |than flo|
|000008e0| 61 74 73 2e 20 49 66 20 | 79 6f 75 27 64 20 72 61 |ats. If |you'd ra|
|000008f0| 74 68 65 72 20 72 75 6e | 0d 73 6c 6f 77 6c 79 20 |ther run|.slowly |
|00000900| 74 68 61 6e 20 6d 6f 64 | 69 66 79 20 79 6f 75 72 |than mod|ify your|
|00000910| 20 4e 75 6d 65 72 69 63 | 61 6c 20 52 65 63 69 70 | Numeric|al Recip|
|00000920| 65 73 20 69 6e 20 43 20 | 66 69 6c 65 73 2c 20 74 |es in C |files, t|
|00000930| 68 65 6e 20 79 6f 75 20 | 77 69 6c 6c 20 6e 65 65 |hen you |will nee|
|00000940| 64 20 74 6f 20 69 6e 73 | 65 72 74 20 0d 22 74 79 |d to ins|ert ."ty|
|00000950| 70 65 64 65 66 20 66 6c | 6f 61 74 20 46 4c 4f 41 |pedef fl|oat FLOA|
|00000960| 54 3b 22 0d 69 6e 20 43 | 61 6c 69 62 72 61 74 65 |T;".in C|alibrate|
|00000970| 4c 75 6d 69 6e 61 6e 63 | 65 2e 63 20 26 20 50 73 |Luminanc|e.c & Ps|
|00000980| 79 63 68 6f 6d 65 74 72 | 69 63 46 69 74 2e 63 20 |ychometr|icFit.c |
|00000990| 69 6e 20 6f 72 64 65 72 | 20 74 6f 20 63 6f 6d 70 |in order| to comp|
|000009a0| 69 6c 65 20 74 68 6f 73 | 65 20 66 69 6c 65 73 2e |ile thos|e files.|
|000009b0| 0d 54 68 65 20 72 65 73 | 74 20 6f 66 20 74 68 65 |.The res|t of the|
|000009c0| 20 56 69 64 65 6f 54 6f | 6f 6c 62 6f 78 20 64 6f | VideoTo|olbox do|
|000009d0| 65 73 6e 27 74 20 63 61 | 72 65 2e 0d 2a 2f 0d 23 |esn't ca|re..*/.#|
|000009e0| 69 6e 63 6c 75 64 65 20 | 22 56 69 64 65 6f 54 6f |include |"VideoTo|
|000009f0| 6f 6c 62 6f 78 2e 68 22 | 0d 23 69 6e 63 6c 75 64 |olbox.h"|.#includ|
|00000a00| 65 20 22 51 75 69 63 6b | 33 2e 68 22 0d 23 69 6e |e "Quick|3.h".#in|
|00000a10| 63 6c 75 64 65 20 22 6e | 72 2e 68 22 0d 23 69 6e |clude "n|r.h".#in|
|00000a20| 63 6c 75 64 65 20 22 6e | 72 75 74 69 6c 2e 68 22 |clude "n|rutil.h"|
|00000a30| 0d 0d 23 64 65 66 69 6e | 65 20 54 4f 4c 45 52 41 |..#defin|e TOLERA|
|00000a40| 4e 43 45 20 30 2e 30 30 | 31 09 2f 2a 20 66 72 61 |NCE 0.00|1./* fra|
|00000a50| 63 74 69 6f 6e 61 6c 20 | 74 6f 6c 65 72 61 6e 63 |ctional |toleranc|
|00000a60| 65 20 6f 66 20 6c 6f 67 | 20 6c 69 6b 65 6c 69 68 |e of log| likelih|
|00000a70| 6f 6f 64 2e 20 4e 6f 74 | 20 63 72 69 74 69 63 61 |ood. Not| critica|
|00000a80| 6c 2e 20 2a 2f 0d 0d 2f | 2a 0d 49 20 68 61 74 65 |l. */../|*.I hate|
|00000a90| 20 67 6c 6f 62 61 6c 20 | 76 61 72 69 61 62 6c 65 | global |variable|
|00000aa0| 73 20 62 65 63 61 75 73 | 65 20 74 68 65 79 20 68 |s becaus|e they h|
|00000ab0| 69 64 65 20 74 68 65 20 | 66 6c 6f 77 20 6f 66 20 |ide the |flow of |
|00000ac0| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 2e 20 48 6f 77 |informat|ion. How|
|00000ad0| 65 76 65 72 2c 0d 73 6f | 6d 65 20 73 6f 72 74 20 |ever,.so|me sort |
|00000ae0| 6f 66 20 63 6c 75 64 67 | 65 20 69 73 20 6e 65 63 |of cludg|e is nec|
|00000af0| 65 73 73 61 72 79 20 74 | 6f 20 70 61 73 73 20 74 |essary t|o pass t|
|00000b00| 68 65 20 65 78 74 72 61 | 20 61 72 67 75 6d 65 6e |he extra| argumen|
|00000b10| 74 73 20 74 6f 20 45 72 | 72 6f 72 28 29 2c 20 62 |ts to Er|ror(), b|
|00000b20| 79 70 61 73 73 69 6e 67 | 0d 74 68 65 20 4e 75 6d |ypassing|.the Num|
|00000b30| 65 72 69 63 61 6c 20 52 | 65 63 69 70 65 73 20 72 |erical R|ecipes r|
|00000b40| 6f 75 74 69 6e 65 73 20 | 74 68 61 74 20 63 61 6c |outines |that cal|
|00000b50| 6c 20 69 74 2c 20 73 69 | 6e 63 65 20 74 68 65 79 |l it, si|nce they|
|00000b60| 20 6f 6e 6c 79 20 70 61 | 73 73 20 74 68 65 20 0d | only pa|ss the .|
|00000b70| 70 61 72 61 6d 65 74 65 | 72 73 20 74 68 65 79 20 |paramete|rs they |
|00000b80| 6b 6e 6f 77 20 61 62 6f | 75 74 2e 20 54 68 65 73 |know abo|ut. Thes|
|00000b90| 65 20 73 74 61 74 69 63 | 20 64 65 63 6c 61 72 61 |e static| declara|
|00000ba0| 74 69 6f 6e 73 20 61 74 | 20 6c 65 61 73 74 20 72 |tions at| least r|
|00000bb0| 65 73 74 72 69 63 74 20 | 74 68 65 20 73 63 6f 70 |estrict |the scop|
|00000bc0| 65 20 6f 66 0d 74 68 65 | 73 65 20 22 67 6c 6f 62 |e of.the|se "glob|
|00000bd0| 61 6c 73 22 20 74 6f 20 | 74 68 69 73 20 66 69 6c |als" to |this fil|
|00000be0| 65 2e 0d 2a 2f 0d 73 74 | 61 74 69 63 20 64 6f 75 |e..*/.st|atic dou|
|00000bf0| 62 6c 65 20 45 72 72 6f | 72 28 46 4c 4f 41 54 20 |ble Erro|r(FLOAT |
|00000c00| 2a 70 29 3b 0d 73 74 61 | 74 69 63 20 64 61 74 61 |*p);.sta|tic data|
|00000c10| 52 65 63 6f 72 64 20 2a | 6d 79 44 61 74 61 50 74 |Record *|myDataPt|
|00000c20| 72 3b 09 09 09 09 2f 2a | 20 66 6f 72 20 45 72 72 |r;..../*| for Err|
|00000c30| 6f 72 28 29 20 2a 2f 0d | 73 74 61 74 69 63 20 50 |or() */.|static P|
|00000c40| 73 79 63 68 6f 6d 65 74 | 72 69 63 46 75 6e 63 74 |sychomet|ricFunct|
|00000c50| 69 6f 6e 50 74 72 20 4d | 79 50 73 79 63 68 46 75 |ionPtr M|yPsychFu|
|00000c60| 6e 3b 09 2f 2a 20 66 6f | 72 20 45 72 72 6f 72 28 |n;./* fo|r Error(|
|00000c70| 29 20 2a 2f 0d 73 74 61 | 74 69 63 20 70 61 72 61 |) */.sta|tic para|
|00000c80| 6d 52 65 63 6f 72 64 20 | 6d 79 50 61 72 61 6d 73 |mRecord |myParams|
|00000c90| 3b 09 09 09 09 2f 2a 20 | 66 6f 72 20 45 72 72 6f |;..../* |for Erro|
|00000ca0| 72 28 29 20 2a 2f 0d 73 | 74 61 74 69 63 20 69 6e |r() */.s|tatic in|
|00000cb0| 74 20 6d 79 44 65 67 72 | 65 65 73 4f 66 46 72 65 |t myDegr|eesOfFre|
|00000cc0| 65 64 6f 6d 3b 09 09 09 | 09 2f 2a 20 66 6f 72 20 |edom;...|./* for |
|00000cd0| 45 72 72 6f 72 28 29 20 | 2a 2f 0d 73 74 61 74 69 |Error() |*/.stati|
|00000ce0| 63 20 69 6e 74 20 69 74 | 65 72 3b 09 09 09 09 09 |c int it|er;.....|
|00000cf0| 09 09 2f 2a 20 66 6f 72 | 20 45 72 72 6f 72 28 29 |../* for| Error()|
|00000d00| 20 2a 2f 0d 0d 64 6f 75 | 62 6c 65 20 50 73 79 63 | */..dou|ble Psyc|
|00000d10| 68 6f 6d 65 74 72 69 63 | 46 69 74 28 70 61 72 61 |hometric|Fit(para|
|00000d20| 6d 52 65 63 6f 72 64 20 | 2a 70 61 72 61 6d 50 74 |mRecord |*paramPt|
|00000d30| 72 2c 50 73 79 63 68 6f | 6d 65 74 72 69 63 46 75 |r,Psycho|metricFu|
|00000d40| 6e 63 74 69 6f 6e 50 74 | 72 20 50 73 79 63 68 46 |nctionPt|r PsychF|
|00000d50| 75 6e 0d 09 2c 64 61 74 | 61 52 65 63 6f 72 64 20 |un..,dat|aRecord |
|00000d60| 2a 64 61 74 61 50 74 72 | 2c 64 6f 75 62 6c 65 20 |*dataPtr|,double |
|00000d70| 2a 6c 6f 67 4c 69 6b 65 | 6c 69 68 6f 6f 64 50 74 |*logLike|lihoodPt|
|00000d80| 72 2c 69 6e 74 20 64 65 | 67 72 65 65 73 4f 66 46 |r,int de|greesOfF|
|00000d90| 72 65 65 64 6f 6d 0d 09 | 2c 64 6f 75 62 6c 65 20 |reedom..|,double |
|00000da0| 2a 63 68 69 53 71 75 61 | 72 65 50 74 72 2c 69 6e |*chiSqua|rePtr,in|
|00000db0| 74 20 2a 63 68 69 53 71 | 75 61 72 65 44 46 50 74 |t *chiSq|uareDFPt|
|00000dc0| 72 29 0d 7b 0d 09 69 6e | 74 20 69 2c 6a 3b 0d 09 |r).{..in|t i,j;..|
|00000dd0| 46 4c 4f 41 54 20 2a 70 | 2c 2a 2a 64 69 72 65 63 |FLOAT *p|,**direc|
|00000de0| 74 69 6f 6e 2c 66 74 6f | 6c 2c 66 72 65 74 3b 0d |tion,fto|l,fret;.|
|00000df0| 09 64 61 74 61 52 65 63 | 6f 72 64 20 6d 6f 6e 6f |.dataRec|ord mono|
|00000e00| 74 6f 6e 69 63 44 61 74 | 61 3b 0d 09 64 6f 75 62 |tonicDat|a;..doub|
|00000e10| 6c 65 20 6d 6f 6e 6f 74 | 6f 6e 69 63 4c 4c 3b 0d |le monot|onicLL;.|
|00000e20| 09 69 6e 74 20 6d 6f 6e | 6f 74 6f 6e 69 63 44 46 |.int mon|otonicDF|
|00000e30| 3b 0d 09 64 6f 75 62 6c | 65 20 50 3b 0d 09 0d 09 |;..doubl|e P;....|
|00000e40| 6d 79 44 61 74 61 50 74 | 72 3d 64 61 74 61 50 74 |myDataPt|r=dataPt|
|00000e50| 72 3b 09 09 2f 2a 20 63 | 6f 70 79 20 74 68 65 73 |r;../* c|opy thes|
|00000e60| 65 20 66 6f 72 20 75 73 | 65 20 62 79 20 45 72 72 |e for us|e by Err|
|00000e70| 6f 72 28 29 20 2a 2f 0d | 09 4d 79 50 73 79 63 68 |or() */.|.MyPsych|
|00000e80| 46 75 6e 3d 50 73 79 63 | 68 46 75 6e 3b 0d 09 6d |Fun=Psyc|hFun;..m|
|00000e90| 79 50 61 72 61 6d 73 3d | 2a 70 61 72 61 6d 50 74 |yParams=|*paramPt|
|00000ea0| 72 3b 0d 09 6d 79 44 65 | 67 72 65 65 73 4f 66 46 |r;..myDe|greesOfF|
|00000eb0| 72 65 65 64 6f 6d 3d 64 | 65 67 72 65 65 73 4f 66 |reedom=d|egreesOf|
|00000ec0| 46 72 65 65 64 6f 6d 3b | 0d 09 0d 09 70 3d 76 65 |Freedom;|....p=ve|
|00000ed0| 63 74 6f 72 28 31 2c 64 | 65 67 72 65 65 73 4f 66 |ctor(1,d|egreesOf|
|00000ee0| 46 72 65 65 64 6f 6d 29 | 3b 0d 09 64 69 72 65 63 |Freedom)|;..direc|
|00000ef0| 74 69 6f 6e 3d 6d 61 74 | 72 69 78 28 31 2c 64 65 |tion=mat|rix(1,de|
|00000f00| 67 72 65 65 73 4f 66 46 | 72 65 65 64 6f 6d 2c 31 |greesOfF|reedom,1|
|00000f10| 2c 64 65 67 72 65 65 73 | 4f 66 46 72 65 65 64 6f |,degrees|OfFreedo|
|00000f20| 6d 29 3b 09 2f 2a 20 69 | 6e 69 74 69 61 6c 20 64 |m);./* i|nitial d|
|00000f30| 69 72 65 63 74 69 6f 6e | 73 20 2a 2f 0d 09 69 66 |irection|s */..if|
|00000f40| 28 70 3d 3d 4e 55 4c 4c | 20 7c 7c 20 64 69 72 65 |(p==NULL| || dire|
|00000f50| 63 74 69 6f 6e 20 3d 3d | 20 4e 55 4c 4c 29 0d 09 |ction ==| NULL)..|
|00000f60| 09 50 72 69 6e 74 66 45 | 78 69 74 28 22 50 73 79 |.PrintfE|xit("Psy|
|00000f70| 63 68 6f 6d 65 74 72 69 | 63 46 69 74 3a 20 6e 6f |chometri|cFit: no|
|00000f80| 74 20 65 6e 6f 75 67 68 | 20 72 6f 6f 6d 20 66 6f |t enough| room fo|
|00000f90| 72 20 61 72 72 61 79 73 | 2e 5c 30 30 37 5c 6e 22 |r arrays|.\007\n"|
|00000fa0| 29 3b 0d 09 66 6f 72 28 | 69 3d 31 3b 69 3c 3d 64 |);..for(|i=1;i<=d|
|00000fb0| 65 67 72 65 65 73 4f 66 | 46 72 65 65 64 6f 6d 3b |egreesOf|Freedom;|
|00000fc0| 69 2b 2b 29 20 70 5b 69 | 5d 3d 28 28 64 6f 75 62 |i++) p[i|]=((doub|
|00000fd0| 6c 65 20 2a 29 70 61 72 | 61 6d 50 74 72 29 5b 69 |le *)par|amPtr)[i|
|00000fe0| 2d 31 5d 3b 0d 09 66 6f | 72 28 69 3d 31 3b 69 3c |-1];..fo|r(i=1;i<|
|00000ff0| 3d 64 65 67 72 65 65 73 | 4f 66 46 72 65 65 64 6f |=degrees|OfFreedo|
|00001000| 6d 3b 69 2b 2b 29 66 6f | 72 28 6a 3d 31 3b 6a 3c |m;i++)fo|r(j=1;j<|
|00001010| 3d 64 65 67 72 65 65 73 | 4f 66 46 72 65 65 64 6f |=degrees|OfFreedo|
|00001020| 6d 3b 6a 2b 2b 29 64 69 | 72 65 63 74 69 6f 6e 5b |m;j++)di|rection[|
|00001030| 69 5d 5b 6a 5d 3d 30 2e | 30 3b 0d 09 66 6f 72 28 |i][j]=0.|0;..for(|
|00001040| 69 3d 31 3b 69 3c 3d 64 | 65 67 72 65 65 73 4f 66 |i=1;i<=d|egreesOf|
|00001050| 46 72 65 65 64 6f 6d 3b | 69 2b 2b 29 64 69 72 65 |Freedom;|i++)dire|
|00001060| 63 74 69 6f 6e 5b 69 5d | 5b 69 5d 3d 30 2e 30 33 |ction[i]|[i]=0.03|
|00001070| 3b 09 2f 2a 20 69 6e 69 | 74 69 61 6c 20 73 74 65 |;./* ini|tial ste|
|00001080| 70 20 73 69 7a 65 20 2a | 2f 0d 09 66 74 6f 6c 3d |p size *|/..ftol=|
|00001090| 54 4f 4c 45 52 41 4e 43 | 45 3b 09 2f 2a 20 66 72 |TOLERANC|E;./* fr|
|000010a0| 61 63 74 69 6f 6e 61 6c | 20 74 6f 6c 65 72 61 6e |actional| toleran|
|000010b0| 63 65 20 6f 6e 20 45 72 | 72 6f 72 20 76 61 6c 75 |ce on Er|ror valu|
|000010c0| 65 20 77 68 65 6e 20 64 | 6f 6e 65 20 2a 2f 0d 09 |e when d|one */..|
|000010d0| 69 74 65 72 3d 30 3b 0d | 09 0d 09 2f 2a 20 64 6f |iter=0;.|.../* do|
|000010e0| 20 69 74 2e 20 54 68 65 | 20 70 73 79 63 68 6f 6d | it. The| psychom|
|000010f0| 65 74 72 69 63 20 66 75 | 6e 63 74 69 6f 6e 20 69 |etric fu|nction i|
|00001100| 73 20 70 61 73 73 65 64 | 20 74 6f 20 45 72 72 6f |s passed| to Erro|
|00001110| 72 20 62 79 20 74 68 65 | 20 67 6c 6f 62 61 6c 20 |r by the| global |
|00001120| 4d 79 50 73 79 63 68 46 | 75 6e 20 2a 2f 0d 09 69 |MyPsychF|un */..i|
|00001130| 66 28 64 65 67 72 65 65 | 73 4f 66 46 72 65 65 64 |f(degree|sOfFreed|
|00001140| 6f 6d 3d 3d 30 29 66 72 | 65 74 3d 45 72 72 6f 72 |om==0)fr|et=Error|
|00001150| 28 70 29 3b 0d 09 65 6c | 73 65 20 70 6f 77 65 6c |(p);..el|se powel|
|00001160| 6c 28 70 2c 64 69 72 65 | 63 74 69 6f 6e 2c 64 65 |l(p,dire|ction,de|
|00001170| 67 72 65 65 73 4f 66 46 | 72 65 65 64 6f 6d 2c 66 |greesOfF|reedom,f|
|00001180| 74 6f 6c 2c 26 69 74 65 | 72 2c 26 66 72 65 74 2c |tol,&ite|r,&fret,|
|00001190| 26 45 72 72 6f 72 29 3b | 0d 0d 09 66 6f 72 28 69 |&Error);|...for(i|
|000011a0| 3d 31 3b 69 3c 3d 64 65 | 67 72 65 65 73 4f 66 46 |=1;i<=de|greesOfF|
|000011b0| 72 65 65 64 6f 6d 3b 69 | 2b 2b 29 20 28 28 64 6f |reedom;i|++) ((do|
|000011c0| 75 62 6c 65 20 2a 29 70 | 61 72 61 6d 50 74 72 29 |uble *)p|aramPtr)|
|000011d0| 5b 69 2d 31 5d 3d 70 5b | 69 5d 3b 0d 09 66 72 65 |[i-1]=p[|i];..fre|
|000011e0| 65 5f 6d 61 74 72 69 78 | 28 64 69 72 65 63 74 69 |e_matrix|(directi|
|000011f0| 6f 6e 2c 31 2c 64 65 67 | 72 65 65 73 4f 66 46 72 |on,1,deg|reesOfFr|
|00001200| 65 65 64 6f 6d 2c 31 2c | 64 65 67 72 65 65 73 4f |eedom,1,|degreesO|
|00001210| 66 46 72 65 65 64 6f 6d | 29 3b 0d 09 66 72 65 65 |fFreedom|);..free|
|00001220| 5f 76 65 63 74 6f 72 28 | 70 2c 31 2c 64 65 67 72 |_vector(|p,1,degr|
|00001230| 65 65 73 4f 66 46 72 65 | 65 64 6f 6d 29 3b 0d 0d |eesOfFre|edom);..|
|00001240| 09 2a 6c 6f 67 4c 69 6b | 65 6c 69 68 6f 6f 64 50 |.*logLik|elihoodP|
|00001250| 74 72 3d 2d 66 72 65 74 | 3b 0d 09 0d 09 2f 2a 20 |tr=-fret|;..../* |
|00001260| 4e 6f 77 20 63 6f 6d 70 | 75 74 65 20 74 68 65 20 |Now comp|ute the |
|00001270| 64 65 67 72 65 65 20 6f | 66 20 73 69 67 6e 69 66 |degree o|f signif|
|00001280| 69 63 61 6e 63 65 20 61 | 74 20 77 68 69 63 68 20 |icance a|t which |
|00001290| 74 68 65 20 66 69 74 20 | 63 61 6e 20 62 65 20 72 |the fit |can be r|
|000012a0| 65 6a 65 63 74 65 64 20 | 2a 2f 0d 09 6d 6f 6e 6f |ejected |*/..mono|
|000012b0| 74 6f 6e 69 63 44 61 74 | 61 3d 20 2a 64 61 74 61 |tonicDat|a= *data|
|000012c0| 50 74 72 3b 0d 09 4d 6f | 6e 6f 74 6f 6e 69 63 46 |Ptr;..Mo|notonicF|
|000012d0| 69 74 28 26 6d 6f 6e 6f | 74 6f 6e 69 63 44 61 74 |it(&mono|tonicDat|
|000012e0| 61 2c 26 6d 6f 6e 6f 74 | 6f 6e 69 63 4c 4c 2c 26 |a,&monot|onicLL,&|
|000012f0| 6d 6f 6e 6f 74 6f 6e 69 | 63 44 46 29 3b 09 2f 2a |monotoni|cDF);./*|
|00001300| 20 6f 76 65 72 77 72 69 | 74 65 73 20 64 61 74 61 | overwri|tes data|
|00001310| 20 77 69 74 68 20 66 69 | 74 20 2a 2f 0d 09 2a 63 | with fi|t */..*c|
|00001320| 68 69 53 71 75 61 72 65 | 50 74 72 3d 20 2d 32 2e |hiSquare|Ptr= -2.|
|00001330| 30 2a 28 2a 6c 6f 67 4c | 69 6b 65 6c 69 68 6f 6f |0*(*logL|ikelihoo|
|00001340| 64 50 74 72 2d 6d 6f 6e | 6f 74 6f 6e 69 63 4c 4c |dPtr-mon|otonicLL|
|00001350| 29 3b 09 2f 2a 20 2d 32 | 20 6c 6f 67 20 6c 69 6b |);./* -2| log lik|
|00001360| 65 6c 69 68 6f 6f 64 20 | 72 61 74 69 6f 20 6f 66 |elihood |ratio of|
|00001370| 20 68 79 70 6f 74 68 65 | 73 65 73 20 2a 2f 0d 09 | hypothe|ses */..|
|00001380| 2a 63 68 69 53 71 75 61 | 72 65 44 46 50 74 72 3d |*chiSqua|reDFPtr=|
|00001390| 6d 6f 6e 6f 74 6f 6e 69 | 63 44 46 2d 64 65 67 72 |monotoni|cDF-degr|
|000013a0| 65 65 73 4f 66 46 72 65 | 65 64 6f 6d 3b 09 09 09 |eesOfFre|edom;...|
|000013b0| 2f 2a 20 64 69 66 66 65 | 72 65 6e 63 65 20 69 6e |/* diffe|rence in|
|000013c0| 20 64 65 67 72 65 65 73 | 20 6f 66 20 66 72 65 65 | degrees| of free|
|000013d0| 64 6f 6d 20 2a 2f 0d 09 | 50 3d 50 43 68 69 53 71 |dom */..|P=PChiSq|
|000013e0| 75 61 72 65 28 2a 63 68 | 69 53 71 75 61 72 65 50 |uare(*ch|iSquareP|
|000013f0| 74 72 2c 2a 63 68 69 53 | 71 75 61 72 65 44 46 50 |tr,*chiS|quareDFP|
|00001400| 74 72 29 3b 09 09 09 2f | 2a 20 73 69 67 6e 69 66 |tr);.../|* signif|
|00001410| 69 63 61 6e 63 65 20 2a | 2f 0d 09 72 65 74 75 72 |icance *|/..retur|
|00001420| 6e 20 50 3b 0d 7d 0d 0d | 2f 2a 20 54 68 65 72 65 |n P;.}..|/* There|
|00001430| 20 69 73 20 61 20 73 75 | 62 74 6c 65 74 79 20 68 | is a su|btlety h|
|00001440| 65 72 65 2e 20 49 20 74 | 68 6f 75 67 68 74 20 74 |ere. I t|hought t|
|00001450| 68 61 74 20 49 20 63 6f | 75 6c 64 20 75 73 65 20 |hat I co|uld use |
|00001460| 50 6f 77 65 6c 6c 20 77 | 69 74 68 20 74 68 65 20 |Powell w|ith the |
|00001470| 77 68 6f 6c 65 0d 70 61 | 72 61 6d 52 65 63 6f 72 |whole.pa|ramRecor|
|00001480| 64 2c 20 79 65 74 20 61 | 73 6b 20 50 6f 77 65 6c |d, yet a|sk Powel|
|00001490| 6c 20 74 6f 20 6f 6e 6c | 79 20 74 77 69 64 64 6c |l to onl|y twiddl|
|000014a0| 65 20 74 68 65 20 66 69 | 72 73 74 20 66 65 77 20 |e the fi|rst few |
|000014b0| 70 61 72 61 6d 65 74 65 | 72 73 2c 20 66 69 67 75 |paramete|rs, figu|
|000014c0| 72 69 6e 67 20 74 68 61 | 74 0d 65 76 65 6e 20 77 |ring tha|t.even w|
|000014d0| 68 65 6e 20 49 20 77 61 | 73 20 61 73 6b 69 6e 67 |hen I wa|s asking|
|000014e0| 20 50 6f 77 65 6c 6c 20 | 74 6f 20 66 69 74 20 6f | Powell |to fit o|
|000014f0| 6e 6c 79 20 74 68 65 20 | 66 69 72 73 74 20 66 65 |nly the |first fe|
|00001500| 77 20 70 61 72 61 6d 65 | 74 65 72 73 20 74 68 65 |w parame|ters the|
|00001510| 20 6f 74 68 65 72 0d 70 | 61 72 61 6d 65 74 65 72 | other.p|arameter|
|00001520| 73 20 77 6f 75 6c 64 20 | 73 74 69 6c 6c 20 62 65 |s would |still be|
|00001530| 20 74 68 65 72 65 20 69 | 6e 20 74 68 65 20 61 72 | there i|n the ar|
|00001540| 72 61 79 20 77 68 65 6e | 20 74 68 65 20 70 6f 69 |ray when| the poi|
|00001550| 6e 74 65 72 20 74 6f 20 | 74 68 65 20 61 72 72 61 |nter to |the arra|
|00001560| 79 20 77 61 73 0d 70 61 | 73 73 65 64 20 74 6f 20 |y was.pa|ssed to |
|00001570| 45 72 72 6f 72 28 29 2e | 20 41 6c 61 73 2c 20 50 |Error().| Alas, P|
|00001580| 6f 77 65 6c 6c 28 29 20 | 61 6e 64 20 69 74 73 20 |owell() |and its |
|00001590| 73 75 62 72 6f 75 74 69 | 6e 65 73 20 6d 61 6b 65 |subrouti|nes make|
|000015a0| 20 43 4f 50 49 45 53 20 | 6f 66 20 74 68 65 20 61 | COPIES |of the a|
|000015b0| 72 72 61 79 2c 0d 61 6e | 64 20 6e 61 74 75 72 61 |rray,.an|d natura|
|000015c0| 6c 6c 79 20 66 61 69 6c | 20 74 6f 20 63 6f 70 79 |lly fail| to copy|
|000015d0| 20 74 68 65 20 6e 6f 6e | 2d 74 77 69 64 64 6c 65 | the non|-twiddle|
|000015e0| 64 20 70 61 72 61 6d 65 | 74 65 72 73 2c 20 73 69 |d parame|ters, si|
|000015f0| 6e 63 65 20 74 68 65 79 | 20 64 6f 6e 27 74 20 6b |nce they| don't k|
|00001600| 6e 6f 77 20 61 62 6f 75 | 74 0d 74 68 65 6d 2e 20 |now abou|t.them. |
|00001610| 54 68 65 20 73 6f 6c 75 | 74 69 6f 6e 20 69 73 20 |The solu|tion is |
|00001620| 66 6f 72 20 45 72 72 6f | 72 28 29 20 74 6f 20 68 |for Erro|r() to h|
|00001630| 61 76 65 20 69 74 73 20 | 6f 77 6e 20 63 6f 6d 70 |ave its |own comp|
|00001640| 6c 65 74 65 20 63 6f 70 | 79 20 6f 66 20 74 68 65 |lete cop|y of the|
|00001650| 20 70 61 72 61 6d 52 65 | 63 6f 72 64 2e 0d 45 61 | paramRe|cord..Ea|
|00001660| 63 68 20 74 69 6d 65 20 | 45 72 72 6f 72 28 29 20 |ch time |Error() |
|00001670| 69 73 20 63 61 6c 6c 65 | 64 20 69 74 20 75 70 64 |is calle|d it upd|
|00001680| 61 74 65 73 20 74 68 65 | 20 74 77 69 64 64 6c 65 |ates the| twiddle|
|00001690| 64 20 70 61 72 61 6d 65 | 74 65 72 73 20 62 65 66 |d parame|ters bef|
|000016a0| 6f 72 65 20 63 61 6c 6c | 69 6e 67 0d 4c 6f 67 4c |ore call|ing.LogL|
|000016b0| 69 6b 65 6c 69 68 6f 6f | 64 28 29 2c 20 77 68 69 |ikelihoo|d(), whi|
|000016c0| 63 68 20 63 61 6c 6c 73 | 20 74 68 65 20 70 73 79 |ch calls| the psy|
|000016d0| 63 68 6f 6d 65 74 72 69 | 63 20 66 75 6e 63 74 69 |chometri|c functi|
|000016e0| 6f 6e 20 28 2a 4d 79 50 | 73 79 63 68 46 75 6e 29 |on (*MyP|sychFun)|
|000016f0| 28 29 2e 0d 2a 2f 0d 0d | 64 6f 75 62 6c 65 20 45 |()..*/..|double E|
|00001700| 72 72 6f 72 28 46 4c 4f | 41 54 20 2a 70 29 0d 7b |rror(FLO|AT *p).{|
|00001710| 0d 09 64 6f 75 62 6c 65 | 20 65 72 72 6f 72 3b 0d |..double| error;.|
|00001720| 09 69 6e 74 20 69 3b 0d | 09 73 74 61 74 69 63 20 |.int i;.|.static |
|00001730| 69 6e 74 20 6c 61 73 74 | 49 74 65 72 3d 30 3b 0d |int last|Iter=0;.|
|00001740| 09 0d 09 66 6f 72 28 69 | 3d 31 3b 69 3c 3d 6d 79 |...for(i|=1;i<=my|
|00001750| 44 65 67 72 65 65 73 4f | 66 46 72 65 65 64 6f 6d |DegreesO|fFreedom|
|00001760| 3b 69 2b 2b 29 20 28 28 | 64 6f 75 62 6c 65 20 2a |;i++) ((|double *|
|00001770| 29 26 6d 79 50 61 72 61 | 6d 73 29 5b 69 2d 31 5d |)&myPara|ms)[i-1]|
|00001780| 3d 70 5b 69 5d 3b 0d 09 | 0d 09 65 72 72 6f 72 3d |=p[i];..|..error=|
|00001790| 2d 4c 6f 67 4c 69 6b 65 | 6c 69 68 6f 6f 64 28 6d |-LogLike|lihood(m|
|000017a0| 79 44 61 74 61 50 74 72 | 2c 26 6d 79 50 61 72 61 |yDataPtr|,&myPara|
|000017b0| 6d 73 2c 4d 79 50 73 79 | 63 68 46 75 6e 29 3b 0d |ms,MyPsy|chFun);.|
|000017c0| 09 0d 09 2f 2a 20 44 69 | 61 67 6e 6f 73 74 69 63 |.../* Di|agnostic|
|000017d0| 20 70 72 69 6e 74 6f 75 | 74 20 66 6f 72 20 64 69 | printou|t for di|
|000017e0| 66 66 69 63 75 6c 74 20 | 63 61 73 65 73 20 2a 2f |fficult |cases */|
|000017f0| 0d 09 69 66 28 69 74 65 | 72 3e 30 20 26 26 20 69 |..if(ite|r>0 && i|
|00001800| 74 65 72 25 35 30 20 3d | 3d 20 30 20 26 26 20 69 |ter%50 =|= 0 && i|
|00001810| 74 65 72 21 3d 6c 61 73 | 74 49 74 65 72 29 7b 0d |ter!=las|tIter){.|
|00001820| 09 09 70 72 69 6e 74 66 | 28 22 45 72 72 6f 72 28 |..printf|("Error(|
|00001830| 29 3a 20 57 61 72 6e 69 | 6e 67 2c 20 25 64 20 69 |): Warni|ng, %d i|
|00001840| 74 65 72 61 74 69 6f 6e | 73 3a 5c 6e 22 2c 28 69 |teration|s:\n",(i|
|00001850| 6e 74 29 69 74 65 72 29 | 3b 0d 09 09 70 72 69 6e |nt)iter)|;...prin|
|00001860| 74 66 28 22 6c 6f 67 41 | 6c 70 68 61 20 25 35 2e |tf("logA|lpha %5.|
|00001870| 32 66 2c 20 62 65 74 61 | 20 25 35 2e 31 66 2c 20 |2f, beta| %5.1f, |
|00001880| 67 61 6d 6d 61 20 25 35 | 2e 32 66 2c 20 64 65 6c |gamma %5|.2f, del|
|00001890| 74 61 20 25 36 2e 33 66 | 20 2d 6c 6f 67 20 6c 69 |ta %6.3f| -log li|
|000018a0| 6b 65 6c 69 68 6f 6f 64 | 20 25 39 2e 30 67 5c 6e |kelihood| %9.0g\n|
|000018b0| 22 0d 09 09 09 2c 6d 79 | 50 61 72 61 6d 73 2e 6c |"....,my|Params.l|
|000018c0| 6f 67 41 6c 70 68 61 2c | 6d 79 50 61 72 61 6d 73 |ogAlpha,|myParams|
|000018d0| 2e 62 65 74 61 2c 6d 79 | 50 61 72 61 6d 73 2e 67 |.beta,my|Params.g|
|000018e0| 61 6d 6d 61 2c 6d 79 50 | 61 72 61 6d 73 2e 64 65 |amma,myP|arams.de|
|000018f0| 6c 74 61 2c 65 72 72 6f | 72 29 3b 0d 09 09 6c 61 |lta,erro|r);...la|
|00001900| 73 74 49 74 65 72 3d 69 | 74 65 72 3b 0d 09 7d 0d |stIter=i|ter;..}.|
|00001910| 09 72 65 74 75 72 6e 20 | 65 72 72 6f 72 3b 0d 7d |.return |error;.}|
|00001920| 0d 0d 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001980| 00 00 01 00 00 00 01 78 | 00 00 00 78 00 00 00 3e |.......x|...x...>|
|00001990| 0d 09 63 68 69 53 71 75 | 61 72 65 44 46 3d 6d 6f |..chiSqu|areDF=mo|
|000019a0| 6e 6f 74 6f 6e 69 63 44 | 46 2d 64 65 67 72 65 65 |notonicD|F-degree|
|000019b0| 11 50 73 79 63 68 6f 6d | 65 74 72 69 63 46 69 74 |.Psychom|etricFit|
|000019c0| 2e 63 02 00 00 00 50 61 | 72 74 53 49 54 21 00 00 |.c....Pa|rtSIT!..|
|000019d0| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|000019e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019f0| 00 00 ab bf ee 4c 00 00 | 00 00 00 00 01 b6 68 69 |.....L..|......hi|
|00001a00| 53 71 75 61 72 65 44 46 | 29 3b 09 09 09 09 2f 2a |SquareDF|);..../*|
|00001a10| 20 73 69 67 6e 69 66 69 | 63 61 6e 63 65 20 2a 2f | signifi|cance */|
|00001a20| 0d 09 72 65 74 75 72 6e | 20 50 3b 0d 7d 0d 0d 2f |..return| P;.}../|
|00001a30| 2a 20 54 68 65 72 65 20 | 69 73 20 61 20 73 75 62 |* There |is a sub|
|00001a40| 74 6c 65 74 79 20 68 65 | 72 65 2e 20 49 20 74 68 |tlety he|re. I th|
|00001a50| 6f 75 67 68 74 20 74 68 | 61 74 20 49 20 63 6f 75 |ought th|at I cou|
|00001a60| 6c 64 20 75 73 65 20 50 | 6f 77 65 6c 6c 20 77 69 |ld use P|owell wi|
|00001a70| 74 68 20 74 68 65 20 77 | 68 6f 6c 65 20 70 61 72 |th the w|hole par|
|00001a80| 00 00 00 28 00 02 00 00 | 16 7f 00 00 16 84 05 45 |...(....|.......E|
|00001a90| 72 72 6f 72 00 00 0c 8c | 00 00 0c 9b 0f 50 73 79 |rror....|.....Psy|
|00001aa0| 63 68 6f 6d 65 74 72 69 | 63 46 69 74 00 00 00 48 |chometri|cFit...H|
|00001ab0| 00 09 4d 6f 6e 61 63 6f | 00 00 00 00 00 00 00 00 |..Monaco|........|
|00001ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ad0| 00 00 00 06 00 04 00 2a | 00 03 01 8d 02 7d 00 2d |.......*|.....}.-|
|00001ae0| 00 04 01 8c 02 7c aa a3 | 5b 2f 00 00 0b 20 00 00 |.....|..|[/... ..|
|00001af0| 0b 20 00 00 00 00 00 00 | 00 00 01 00 00 00 01 78 |. ......|.......x|
|00001b00| 00 00 00 78 00 00 00 3e | 00 a2 a6 ec 1b 2e 00 00 |...x...>|........|
|00001b10| 00 1c 00 3e 00 00 4d 50 | 53 52 00 01 00 0a 03 ef |...>..MP|SR......|
|00001b20| ff ff 00 00 00 00 00 00 | 00 00 03 ed ff ff 00 00 |........|........|
|00001b30| 00 2c 00 a2 a6 0c 00 00 | 00 00 00 00 00 00 00 00 |.,......|........|
|00001b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+